package cc.comac.mom.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cc.comac.mom.api.EquipWarehouseStockService;
import cc.comac.mom.bean.EquipWarehouseStock;
import cc.comac.mom.bean.EquipWarehouseStockBean;
import cc.comac.mom.bean.ResultDev;
import cc.comac.mom.util.ResultBean;

@RestController
@RequestMapping("/EquipWarehouseStock")
public class EquipWarehouseStockController {

	@Autowired
	private EquipWarehouseStockService equipWarehouseStockService;
	
	@RequestMapping(value = "/selectBySparePartId",method = RequestMethod.POST)
	public ResultBean selectBySparePartId(@RequestBody EquipWarehouseStock equipWarehouseStock) {
		ResultBean resultBean = new ResultBean(true);
		try {
			ResultDev selectBySparePartId = equipWarehouseStockService.selectBySparePartId(equipWarehouseStock);
			resultBean.setObject(selectBySparePartId);
		} catch (RuntimeException e) {
			resultBean.setErrorMessge(e.getMessage());
			return resultBean;
		}
		return resultBean;
	}
	
	@RequestMapping(value = "/selectByFields",method = RequestMethod.POST)
	public ResultBean selectByFields(@RequestBody EquipWarehouseStockBean obj) {
		ResultBean resultBean = new ResultBean(true);
		ResultDev resultDev = equipWarehouseStockService.selectByFields(obj);
		resultBean.setObject(resultDev);
		return resultBean;
		
	}
	
}
